package com.ziq.baselib.test.hilt

import android.annotation.SuppressLint
import android.os.Bundle
import com.ziq.base.base.BaseActivity
import com.ziq.base.manager.RetrofitManager
import com.ziq.base.extension.binding
import com.ziq.baselib.databinding.ActivityHiltBinding
import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent


class HiltActivity2: BaseActivity() {

    private val binding : ActivityHiltBinding by binding()

    @EntryPoint
    @InstallIn(SingletonComponent::class)
    interface HiltActivityEntryPoint{
        fun retrofitManager(): RetrofitManager
    }

    @SuppressLint("SetTextI18n")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding.root
        binding.tv.text = "hilt2"
        val hiltEntryPoint = EntryPointAccessors.fromApplication(this, HiltActivityEntryPoint::class.java)
        println("Hilt2   ${hiltEntryPoint.retrofitManager().hashCode()}")
    }
}